/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package queenb.web.controller;

import java.util.List;
import queenb.net.entitybean.N050;
import queenb.web.store.N050Store;
import queenb.web.util.Util;

/**
 *
 * @author Hung.Ngo
 */
public class N050Controller extends QueenbController{
    private int PN050;
    private String NV051;
    private N050Store store;
    public N050Controller(){
        store = new N050Store();
    }
    
    public List<N050> getListALlN050(){
        try {
            List<N050> list = store.getListN050(getLogin().getModule(), getLogin().getCompanyNo(), getLogin().getUserName());
            return list;
        } catch (Exception e) {
            return null;
        }
    }
    
    
    public void updateN050(){
        try {
            int row = store.updateN050(getPN050(), getLogin().getModule(), getLogin().getCompanyNo(), getNV051(), getLogin().getUserName());
            if (row > 0) {
                showGlobalReport(true, getResourceString("datasavesuccessful"));
            } else {

                showGlobalReport(true, getResourceString("datasuccessfail"));
            }
            sendRedirectUrlTab("setting.jsp?tab=header22&linkN050"+Util.convertMD5(getRequest().getRequestURI()));
        } catch (Exception e) {
            System.out.print(e.getMessage());
        }
    }

    /**
     * @return the PN050
     */
    public int getPN050() {
        return PN050;
    }

    /**
     * @param PN050 the PN050 to set
     */
    public void setPN050(int PN050) {
        this.PN050 = PN050;
    }

    /**
     * @return the NV051
     */
    public String getNV051() {
        return NV051;
    }

    /**
     * @param NV051 the NV051 to set
     */
    public void setNV051(String NV051) {
        this.NV051 = NV051;
    }
    
}
